Skip to content

SQL: add multi-index support to legacy mode #6883

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

jorisvandenbossche
Copy link
Member

Closes #6881.

@danielballan Added multi-index support to legacy mode, wasn't actually not that difficult (all tests seems to pass). And at once also index_label kwarg is supported in legacy mode.

This just leaves the issue that this is actually an api change, so could possibly break code.

and at once also index_label kwarg support
@danielballan
Copy link
Contributor

That was quick. This seems like the best outcome from an assortment of confusing compromises, any of which could mean trouble for legacy code. Looks good to me.

I will proceed with #6796 once this is merged.

@jorisvandenbossche
Copy link
Member Author

@jreback @hayd What do you think of the API change (before: no index was written, now index kwarg to write index which is set to True by default)?

@jorisvandenbossche
Copy link
Member Author

Actually, we could also set index to False when using write_frame, and leave it as True for to_sql. to_sql is a new function, so for that the backwards incompatibility is not a problem.

(at this moment, write_frame is just passed in its entirety to to_sql)

@jorisvandenbossche
Copy link
Member Author

@jreback @hayd OK with this? I added a commit that changes the default index to False for write_frame (behaviour of 0.13), for to_sql (new function) it is then index=True. As this is the most backwards compatible I suppose no objections?

@jreback
Copy link
Contributor

jreback commented Apr 15, 2014

looks ok

jorisvandenbossche added a commit that referenced this pull request Apr 15, 2014
SQL: add multi-index support to legacy mode
@jorisvandenbossche jorisvandenbossche merged commit f418d6c into pandas-dev:master Apr 15, 2014
@jorisvandenbossche
Copy link
Member Author

Ahum, I was actually completely wrong here... to_sql did already exist of course, it was added in 0.12. It was just not in the sql module but only as a method of DataFrame where it called directly write_frame, and it was not mentioned in the docs.
So my reasoning was not correct, and for to_sql this remains a backwards incompatible api change.

@danielballan
Copy link
Contributor

Bummer. But I still think this is the lesser evil. Dropping the index was always a weird behavior, an indication that the SQL capability wasn't mature and should be used cautiously.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

API: SQL legacy mode to_sql 'index' kwarg behaviour
3 participants